package UnOfficeDeTourisme;

/**
 * Interface definition : SGCatalogue
 * 
 * @author OpenORB Compiler
 */
public abstract class SGCataloguePOA extends org.omg.PortableServer.Servant
        implements SGCatalogueOperations, org.omg.CORBA.portable.InvokeHandler
{
    public SGCatalogue _this()
    {
        return SGCatalogueHelper.narrow(_this_object());
    }

    public SGCatalogue _this(org.omg.CORBA.ORB orb)
    {
        return SGCatalogueHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:UnOfficeDeTourisme/SGCatalogue:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("consulterCat")) {
                return _invoke_consulterCat(_is, handler);
        } else if (opName.equals("creerCatalogue")) {
                return _invoke_creerCatalogue(_is, handler);
        } else if (opName.equals("listerCat")) {
                return _invoke_listerCat(_is, handler);
        } else if (opName.equals("listerPresta")) {
                return _invoke_listerPresta(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke_creerCatalogue(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Catalogue arg0_in = UnOfficeDeTourisme.CatalogueHelper.read(_is);

        creerCatalogue(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_consulterCat(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();

        UnOfficeDeTourisme.Catalogue _arg_result = consulterCat(arg0_in);

        _output = handler.createReply();
        UnOfficeDeTourisme.CatalogueHelper.write(_output,_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_listerCat(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;

        try
        {
            UnOfficeDeTourisme.Catalogue[] _arg_result = listerCat();

            _output = handler.createReply();
            UnOfficeDeTourisme.listeCataloguesHelper.write(_output,_arg_result);

        }
        catch (UnOfficeDeTourisme.ListeVideException _exception)
        {
            _output = handler.createExceptionReply();
            UnOfficeDeTourisme.ListeVideExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_listerPresta(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Catalogue arg0_in = UnOfficeDeTourisme.CatalogueHelper.read(_is);

        try
        {
            UnOfficeDeTourisme.Prestation[] _arg_result = listerPresta(arg0_in);

            _output = handler.createReply();
            UnOfficeDeTourisme.listePrestationsHelper.write(_output,_arg_result);

        }
        catch (UnOfficeDeTourisme.ListeVideException _exception)
        {
            _output = handler.createExceptionReply();
            UnOfficeDeTourisme.ListeVideExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

}
